1
|
|
|
import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm'; |
2
|
|
|
import {User} from './User.entity'; |
3
|
|
|
|
4
|
|
|
export enum ContractType { |
5
|
|
|
CDI = 'cdi', |
6
|
|
|
CDD = 'cdd', |
7
|
|
|
CTT = 'ctt', |
8
|
|
|
APPRENTICESHIP = 'apprenticeship', |
9
|
|
|
PROFESSIONALIZATION = 'professionalization' |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
@Entity() |
13
|
|
|
export class UserAdministrative { |
14
|
|
|
@PrimaryGeneratedColumn('uuid') |
15
|
|
|
private id: string; |
16
|
|
|
|
17
|
|
|
@Column({type: 'timestamp', nullable: false}) |
18
|
|
|
private joiningDate: string; |
19
|
|
|
|
20
|
|
|
@Column({type: 'timestamp', nullable: true}) |
21
|
|
|
private leavingDate: string; |
22
|
|
|
|
23
|
|
|
@Column({type: 'integer', nullable: false}) |
24
|
|
|
private annualEarnings: number; |
25
|
|
|
|
26
|
|
|
@Column({type: 'integer', default: 0, nullable: true}) |
27
|
|
|
private transportFee: number; |
28
|
|
|
|
29
|
|
|
@Column({type: 'boolean', nullable: false}) |
30
|
|
|
private healthInsurance: boolean; |
31
|
|
|
|
32
|
|
|
@Column({type: 'boolean', nullable: false}) |
33
|
|
|
private executivePosition: boolean; |
34
|
|
|
|
35
|
|
|
@Column('enum', {enum: ContractType, nullable: false}) |
36
|
|
|
private contract: ContractType; |
37
|
|
|
|
38
|
|
|
@ManyToOne(type => User, {nullable: false}) |
39
|
|
|
private user: User; |
40
|
|
|
|
41
|
|
|
constructor( |
42
|
|
|
joiningDate: Date, |
43
|
|
|
leavingDate: Date, |
44
|
|
|
annualEarnings: number, |
45
|
|
|
transportFee: number, |
46
|
|
|
healthInsurance: boolean, |
47
|
|
|
executivePosition: boolean, |
48
|
|
|
contract: ContractType, |
49
|
|
|
user: User |
50
|
|
|
) { |
51
|
|
|
this.joiningDate = joiningDate.toISOString(); |
52
|
|
|
this.leavingDate = leavingDate.toISOString(); |
53
|
|
|
this.annualEarnings = annualEarnings; |
54
|
|
|
this.transportFee = transportFee; |
55
|
|
|
this.healthInsurance = healthInsurance; |
56
|
|
|
this.executivePosition = executivePosition; |
57
|
|
|
this.contract = contract; |
58
|
|
|
this.user = user; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public getId(): string { |
62
|
|
|
return this.id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public getJoiningDate(): string { |
66
|
|
|
return this.joiningDate; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public getLeavingDate(): string { |
70
|
|
|
return this.leavingDate; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public getAnnualEarnings(): number { |
74
|
|
|
return this.annualEarnings; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public getTransportFee(): number { |
78
|
|
|
return this.transportFee; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public haveHealthInsurance(): boolean { |
82
|
|
|
return this.healthInsurance; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public isExecutivePosition(): boolean { |
86
|
|
|
return this.executivePosition; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public getContract(): ContractType { |
90
|
|
|
return this.contract; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public getUser(): User { |
94
|
|
|
return this.user; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|